package model;

import java.io.Serializable;

/**
 * @author Jochen
 * 
 * @since 28.04.2011
 * @version 05.05.11 - Johannes - Changed the owner type from string to int and correct datatypes of getter and setter methods.
 * @version 05.05.11 - Jochen - Added comments for the setRent functions; Added function: setCosts, setHousePrice
 */
public class Field implements Serializable
{
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 1L;
	
	
	/**
	 * FIELD is a data container, for all different kinds of fields on the Monopoly board
	 * ONE class for ALL fields 
	 * 
	 * id			the field's number; Go has the number 0
	 * name			street's name
	 * type			is the field a street, station, plant, special
	 * colour		if the field is a street, then which colour it belongs to
	 * owner		is the field already sold to a player
	 * costs		amount of money a player has to spend, when he wants to purchase the field
	 * houses		how many houses are built yet; 0 is none; 5 is a hotel
	 * house_price	price for upgrading for 1 house
	 * house0 		rent, when no house is built on the street
	 * house1    	rent, when 1 house is built on the street
	 * house2      	rent, when 2 houses are built on the street
	 * house3 		rent, when 3 houses are built on the street
	 * house4 		rent, when 4 houses are built on the street
	 * hotel 		rent, when a hotel (=5 houses) is built on the street
	 *         
	 */
	
	private String type, name, colour;
	private int owner;	//05.05.11 - Johannes - changed the owner type from string to int 
    private int id, costs, houses, housePrice;
    private int house0, house1, house2, house3, house4, hotel;
        
    /**
     * A Monopoly playboard has 40 different fields. This is the Constructor for 1 field. FIELD is a data container.
     * 
     * @param id the field's number; Go has the number 0
     * @param name street's name
     * @param type is the field a street, station, plant, special
     * @param colour if the field is a street, then which colour it belongs to
     * @param costs amount of money a player has to spend, when he wants to purchase the field
     * @param h_price price for upgrading for 1 house
     * @param house0 rent, when no house is built on the street
     * @param house1 rent, when 1 house is built on the street
     * @param house2 rent, when 2 houses are built on the street
     * @param house3 rent, when 3 houses are built on the street
     * @param house4 rent, when 4 houses are built on the street
     * @param hotel rent, when a hotel (=5 houses) is built on the street
     */
        public Field(int id, String name, String type, String colour, int costs, int h_price, int house0, int house1, int house2, int house3, int house4, int hotel)
        {
            this.id = id;
            this.name = name;
        	this.type = type;
        	this.colour = colour;
        	this.costs = costs;
        	this.housePrice = h_price;
        	this.house0 = house0;
        	this.house1 = house1;
        	this.house2 = house2;
        	this.house3 = house3;
        	this.house4 = house4;
        	this.hotel  = hotel;
        	
        	//-1 says that the street belongs to nobody
        	this.owner = -1; //05.05.2011 - Johannes - Changed from "" to -1 
        	this.houses = 0;
        }
        
        
        /*
         * #############
         * GET Functions
         * #############
         */
        
        
        /**
         * is the field a street, station, plant, special
         * @return the type
         */
        public String getType()
        {
            return this.type;
        }
        
        
        /**
         * street's name
         * @return the name
         */
        public String getName()
        {
            return this.name;
        }
        
        
        /**
         * the field's number; Go has the number 0
         * @return the id
         */            
        public int getId()
        {
            return this.id;
        }
        
        
        /**
         * price for upgrading for 1 house
         * @return this.housePrice is the price for build one house on this field  
         */
        public int getHousePrice()
        {
            return this.housePrice;
        }
        
        
        /**
         * if the field is a street, then which colour it belongs to; HEX Code of colour
         * @return this.colour returns the colour of this field, no colour if its not a street
         */
        public String getColour()
        {
            return this.colour;
        }
        
        
        /**
         * Returns the player number of the owner or -1 if the street belongs tho nobody
         *  
         * @return player number.
         */
        public int getOwner() ////05.05.11 - Johannes - changed type from string to int
        {
            return this.owner;
        }
        
        
        /**
         * amount of money a player has to spend, when he wants to purchase the field
         * @return this.costs returns the amount of money a player has to spend, when he wants to purchase this field
         */
        public int getCosts()
        {
            return this.costs;
        }
        
        
        /**
         * how many houses are built yet; 0 is none; 5 is a hotel
         * @return this.houses returns how many houses are build on this field
         */
        public int getHouses()
        {
            return this.houses;
        }
        
        
        /**
         * rent, when no house is built on the street
         * @return this.house() returns the rent, when no house is built on the street
         */
        public int getRentHouse0()
        {
            return this.house0;
        }
        
        
        /**
         * rent, when 1 house is built on the street
         * @return this.house1 returns the rent for one house on the street
         */
        public int getRentHouse1()
        {
            return this.house1;
        }
        
        
        /**
         * rent, when 2 houses are built on the street
         * @return this.house2 returns the rent for two houses on the street
         */
        public int getRentHouse2()
        {
            return this.house2;
        }
        
        
        /**
         * rent, when 3 houses are built on the street
         * @return this.house3 returns the rent for three houses on the street
         */
        public int getRentHouse3()
        {
            return this.house3;
        }
        
        
        /**
         * rent, when 4 houses are built on the street
         * @return this.house4 returns the rent for four houses on the street
         */
        public int getRentHouse4()
        {
            return this.house4;
        }
        
        
        /**
         * rent, when a hotel (=5 houses) is built on the street
         * @return this.hotel returns the rent for a hotel on the street
         */
        public int getRentHotel()
        {
            return this.hotel;
        }
        
        /*
         * #############
         * SET Functions
         * #############
         */
        /**
         * Setting the house price for a street.
         * @param price Price for a house
         */
        public void setHousePrice(int price)
        {
        	this.housePrice = price;
        }
        
        /**
         * Setting the price for a street.
         * @param costs Price for a street
         */
        public void setCosts(int costs)
        {
        	this.costs = costs;
        }
        
        /**
         * Setting the corresponding rent!
         * @param rent The corresponding rent.
         */
        public void setRentHouse0(int rent)
        {
        	this.house0 = rent;
        }
        
        /**
         * Setting the corresponding rent!
         * @param rent The corresponding rent.
         */        
        public void setRentHouse1(int rent)
        {
        	this.house1 = rent;
        }
 
        /**
         * Setting the corresponding rent!
         * @param rent The corresponding rent.
         */        
        public void setRentHouse2(int rent)
        {
        	this.house2 = rent;
        }
        
        /**
         * Setting the corresponding rent!
         * @param rent The corresponding rent.
         */        
        public void setRentHouse3(int rent)
        {
        	this.house3 = rent;
        }
        
        /**
         * Setting the corresponding rent!
         * @param rent The corresponding rent.
         */        
        public void setRentHouse4(int rent)
        {
        	this.house4 = rent;
        }
        
        /**
         * Setting the corresponding rent!
         * @param rent The corresponding rent.
         */        
        public void setRentHotel(int rent)
        {
        	this.hotel = rent;
        }
        
        
        /**
         * Sets the owner of a street.
         * 
         * @param number the player number
         */
        public void setOwner(int number) //05.05.2011 - Johannes - changed type from string to int
        {
            this.owner = number;
        }
        
        /*
         * #############
         * CHANGE Functions
         * #############
         */
        
        
        /**
         * changes the amount of houses, built on this street
         * @param value can be a +value or -value and should be +1 or -1
         */
        public void changeHouses(int value)
        {
        	this.houses = this.houses + value;
        }
        
        
}

